//PITCH PROGRAM
//CLASS: PLAYERPANEL
//	-panel to show cards that have been played
//BY: ALEX TRACY
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;


public class PlayedPanel extends JPanel
{
	private static BufferedImage played[] = new BufferedImage[4];
	
	public PlayedPanel()
	{
		for (int i = 0 ; i < 4 ; i++)
			played[i] = null;
	}

	//draws cards that have been played in front
	//of play who played them
	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		initPlayed();
		g.drawImage(played[0], 75 , 150,null);
		g.drawImage(played[1], 0 , 75, null);
		g.drawImage(played[2], 75 , 0, null);
		g.drawImage(played[3], 150 , 75, null);
	}//End paintCompnent
	
	//if a card has been played show an image of it
	//otherwise show nothing
	public static void initPlayed()
	{
		for (int i = 0 ; i < 4 ; i++)
		{
			if (Play.getThrown(i) != -1)
				played[i] = Card.getCardImg(Play.getThrown(i));
			else
				played[i] = null;
		}
	}//End initPlayed
	

}//End PlayedPanel

